//
//  YTTGroupController.m
//  跑圈儿
//
//  Created by 唐康 on 16/4/19.
//  Copyright © 2016年 唐康. All rights reserved.
//

#import "YTTGroupController.h"
#import "YTTChartController.h"

@interface YTTGroupController ()

@property(nonatomic, strong)UIWebView *mainWebView;
@end

@implementation YTTGroupController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setupBarItem];
    [self creationMainWebView];
        self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:(UIBarButtonItemStyleDone) target:self action:@selector(back)];
    
    
}

- (void)setupBarItem{
    self.view.backgroundColor = [UIColor lightGrayColor];
    self.navigationItem.title = @"群组";
    //设置群组排行导航按钮按钮
    UIBarButtonItem *chartBtn = [UIBarButtonItem itemWithImage:@"chart" highLightImage:@"chart_click" target:self action:@selector(gotoChart)];
    self.navigationItem.leftBarButtonItems = @[chartBtn];
    //我的分组
    UIBarButtonItem *myGroupItem = [UIBarButtonItem itemWithImage:@"my_group" highLightImage:@"my_group_click" target:self action:@selector(gotoMyGroup)];
    //搜索
    UIBarButtonItem *searchItem = [UIBarButtonItem itemWithImage:@"search" highLightImage:@"search_click" target:self action:@selector(gotoSearch)];
    //扫码 发布
    UIBarButtonItem *addItem = [UIBarButtonItem itemWithImage:@"add" highLightImage:@"add_click" target:self action:@selector(gotoPublish)];
    self.navigationItem.rightBarButtonItems = @[addItem,searchItem,myGroupItem];
    
}

/**
 *  扫码 发布
 */
- (void)gotoPublish{
    YTTLog(@"嘿嘿");
}




/**
 *  搜索
 */
- (void)gotoSearch{
    
}


/**
 *  我的分组
 */
- (void)gotoMyGroup{
    
}


/**
 *  我的排行
 */
- (void)gotoChart{
    YTTChartController *chartVC = [[YTTChartController alloc]init];
    [self.navigationController pushViewController:chartVC animated:YES];
}
#pragma mark - 创建WebView
-(void)creationMainWebView{
    
    self.mainWebView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 64)];
    self.mainWebView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.mainWebView];
    
    self.mainWebView.scalesPageToFit = YES;              //自动对页面进行缩放以适应屏幕
    self.mainWebView.detectsPhoneNumbers = YES;          //自动检测网页上的电话号码,单机可以拨打
    NSURL *url = [NSURL URLWithString:@"http://life.ledongli.cn"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.mainWebView loadRequest:request];
    
    
    //加载
    
    
}
- (void)back{
    
    [self.mainWebView goBack];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
